<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libschc: compressor.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libschc
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">compressor.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;string.h&gt;</code><br />
<code>#include &lt;stdio.h&gt;</code><br />
<code>#include &quot;<a class="el" href="jsmn_8h_source.html">jsmn.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="picocoap_8h_source.html">picocoap.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="compressor_8h_source.html">compressor.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="schc__config_8h_source.html">schc_config.h</a>&quot;</code><br />
<code>#include &quot;rules/rule_config.h&quot;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ac1569580e90e636a6d48366af83f3164"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#ac1569580e90e636a6d48366af83f3164">get_node_ip</a> (<a class="el" href="schc_8h.html#a871e6877df8d1bf5f1d0690d6b918f6b">schc_ipaddr_t</a> *node_ip)</td></tr>
<tr class="memdesc:ac1569580e90e636a6d48366af83f3164"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the node its IP address as set during initialization.  <a href="compressor_8c.html#ac1569580e90e636a6d48366af83f3164">More...</a><br /></td></tr>
<tr class="separator:ac1569580e90e636a6d48366af83f3164"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac9e32a3cb72316274db7b597a9aca407"><td class="memItemLeft" align="right" valign="top">static struct <a class="el" href="structschc__device.html">schc_device</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#ac9e32a3cb72316274db7b597a9aca407">get_device_by_id</a> (uint32_t device_id)</td></tr>
<tr class="memdesc:ac9e32a3cb72316274db7b597a9aca407"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a device by it's id.  <a href="compressor_8c.html#ac9e32a3cb72316274db7b597a9aca407">More...</a><br /></td></tr>
<tr class="separator:ac9e32a3cb72316274db7b597a9aca407"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a15002a02e9cae01e5629cb2d474fe482"><td class="memItemLeft" align="right" valign="top">int8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a15002a02e9cae01e5629cb2d474fe482">set_rule_id</a> (struct <a class="el" href="structschc__rule__t.html">schc_rule_t</a> *schc_rule, uint8_t *data)</td></tr>
<tr class="separator:a15002a02e9cae01e5629cb2d474fe482"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaf76c0525a94eecb1f694ba09b435c49"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structschc__rule__t.html">schc_rule_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#aaf76c0525a94eecb1f694ba09b435c49">get_schc_rule_by_reliability_mode</a> (struct <a class="el" href="structschc__rule__t.html">schc_rule_t</a> *schc_rule, <a class="el" href="schc_8h.html#a00b61f9b90ab7065eb6a978141d7fd34">reliability_mode</a> mode, uint32_t device_id)</td></tr>
<tr class="separator:aaf76c0525a94eecb1f694ba09b435c49"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab1cdc4ecc8218636dd177a43cf85bb63"><td class="memItemLeft" align="right" valign="top">static struct <a class="el" href="structschc__rule__t.html">schc_rule_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#ab1cdc4ecc8218636dd177a43cf85bb63">get_schc_rule_by_layer_ids</a> (uint8_t ip_rule_id, uint8_t udp_rule_id, uint8_t coap_rule_id, uint32_t device_id, <a class="el" href="schc_8h.html#a00b61f9b90ab7065eb6a978141d7fd34">reliability_mode</a> mode)</td></tr>
<tr class="separator:ab1cdc4ecc8218636dd177a43cf85bb63"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0403165232716bdd5f3a06169692c2a9"><td class="memItemLeft" align="right" valign="top">struct <a class="el" href="structschc__rule__t.html">schc_rule_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a0403165232716bdd5f3a06169692c2a9">get_schc_rule_by_rule_id</a> (uint8_t *rule_arr, uint32_t device_id)</td></tr>
<tr class="separator:a0403165232716bdd5f3a06169692c2a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a965c3a63dd22c405c83c4164f10f9985"><td class="memItemLeft" align="right" valign="top">static uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a965c3a63dd22c405c83c4164f10f9985">compress</a> (<a class="el" href="structschc__bitarray__t.html">schc_bitarray_t</a> *dst, <a class="el" href="structschc__bitarray__t.html">schc_bitarray_t</a> *src, const struct <a class="el" href="structschc__layer__rule__t.html">schc_layer_rule_t</a> *rule, <a class="el" href="schc_8h.html#a99f26e6ee9fcd62f75203b5402df8098">direction</a> DI)</td></tr>
<tr class="memdesc:a965c3a63dd22c405c83c4164f10f9985"><td class="mdescLeft">&#160;</td><td class="mdescRight">The compression mechanism.  <a href="compressor_8c.html#a965c3a63dd22c405c83c4164f10f9985">More...</a><br /></td></tr>
<tr class="separator:a965c3a63dd22c405c83c4164f10f9985"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af8317d5d5e72076851ec7fe49688f4a7"><td class="memItemLeft" align="right" valign="top">static uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#af8317d5d5e72076851ec7fe49688f4a7">decompress</a> (struct <a class="el" href="structschc__layer__rule__t.html">schc_layer_rule_t</a> *rule, <a class="el" href="structschc__bitarray__t.html">schc_bitarray_t</a> *src, <a class="el" href="structschc__bitarray__t.html">schc_bitarray_t</a> *dst, <a class="el" href="schc_8h.html#a99f26e6ee9fcd62f75203b5402df8098">direction</a> DI)</td></tr>
<tr class="memdesc:af8317d5d5e72076851ec7fe49688f4a7"><td class="mdescLeft">&#160;</td><td class="mdescRight">The decompression mechanism.  <a href="compressor_8c.html#af8317d5d5e72076851ec7fe49688f4a7">More...</a><br /></td></tr>
<tr class="separator:af8317d5d5e72076851ec7fe49688f4a7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8137a81bb5ae333086b8aaf814b10a62"><td class="memItemLeft" align="right" valign="top">static struct <a class="el" href="structschc__layer__rule__t.html">schc_layer_rule_t</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a8137a81bb5ae333086b8aaf814b10a62">schc_find_rule_from_header</a> (<a class="el" href="structschc__bitarray__t.html">schc_bitarray_t</a> *src, uint32_t device_id, <a class="el" href="schc_8h.html#ac6a26bb50f32ca8810179e894e284ea0">schc_layer_t</a> layer, <a class="el" href="schc_8h.html#a99f26e6ee9fcd62f75203b5402df8098">direction</a> DI)</td></tr>
<tr class="memdesc:a8137a81bb5ae333086b8aaf814b10a62"><td class="mdescLeft">&#160;</td><td class="mdescRight">Find a matching rule for a layer.  <a href="compressor_8c.html#a8137a81bb5ae333086b8aaf814b10a62">More...</a><br /></td></tr>
<tr class="separator:a8137a81bb5ae333086b8aaf814b10a62"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a263bfe2b1b6914b5b715f434f154d07b"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a263bfe2b1b6914b5b715f434f154d07b">swap_ipv6_source_and_destination</a> (uint8_t *ptr)</td></tr>
<tr class="memdesc:a263bfe2b1b6914b5b715f434f154d07b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Swaps the IPv6 source and destination.  <a href="compressor_8c.html#a263bfe2b1b6914b5b715f434f154d07b">More...</a><br /></td></tr>
<tr class="separator:a263bfe2b1b6914b5b715f434f154d07b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9991f6ae222b8d657ebb0e0b162ea282"><td class="memItemLeft" align="right" valign="top">static uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a9991f6ae222b8d657ebb0e0b162ea282">equal</a> (struct <a class="el" href="structschc__field.html">schc_field</a> *target_field, unsigned char *field_value, uint16_t field_offset)</td></tr>
<tr class="memdesc:a9991f6ae222b8d657ebb0e0b162ea282"><td class="mdescLeft">&#160;</td><td class="mdescRight">The equal matching operator.  <a href="compressor_8c.html#a9991f6ae222b8d657ebb0e0b162ea282">More...</a><br /></td></tr>
<tr class="separator:a9991f6ae222b8d657ebb0e0b162ea282"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a394540a77045dcb0230079435b631960"><td class="memItemLeft" align="right" valign="top">static uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a394540a77045dcb0230079435b631960">ignore</a> (struct <a class="el" href="structschc__field.html">schc_field</a> *target_field, unsigned char *field_value, uint16_t field_offset)</td></tr>
<tr class="memdesc:a394540a77045dcb0230079435b631960"><td class="mdescLeft">&#160;</td><td class="mdescRight">The ignore matching operator.  <a href="compressor_8c.html#a394540a77045dcb0230079435b631960">More...</a><br /></td></tr>
<tr class="separator:a394540a77045dcb0230079435b631960"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abd91def21b62074e08368e9bb11593d5"><td class="memItemLeft" align="right" valign="top">static uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#abd91def21b62074e08368e9bb11593d5">MSB</a> (struct <a class="el" href="structschc__field.html">schc_field</a> *target_field, unsigned char *field_value, uint16_t field_offset)</td></tr>
<tr class="memdesc:abd91def21b62074e08368e9bb11593d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">The MSB matching operator MSB(x): a match is obtained if the most significant (leftmost) x bits of the packet header field value are equal to the TV in the Rule.  <a href="compressor_8c.html#abd91def21b62074e08368e9bb11593d5">More...</a><br /></td></tr>
<tr class="separator:abd91def21b62074e08368e9bb11593d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5371dbc9847ed58dc760b7f028ea14e9"><td class="memItemLeft" align="right" valign="top">static uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a5371dbc9847ed58dc760b7f028ea14e9">matchmap</a> (struct <a class="el" href="structschc__field.html">schc_field</a> *target_field, unsigned char *field_value, uint16_t field_offset)</td></tr>
<tr class="memdesc:a5371dbc9847ed58dc760b7f028ea14e9"><td class="mdescLeft">&#160;</td><td class="mdescRight">The match-map matching operator match-mapping: With match-mapping, the Target Value is a list of values.  <a href="compressor_8c.html#a5371dbc9847ed58dc760b7f028ea14e9">More...</a><br /></td></tr>
<tr class="separator:a5371dbc9847ed58dc760b7f028ea14e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3e74925e4bb4cb937a3ac4b951f41119"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a3e74925e4bb4cb937a3ac4b951f41119">set_node_ip</a> (<a class="el" href="schc_8h.html#a871e6877df8d1bf5f1d0690d6b918f6b">schc_ipaddr_t</a> *node_ip)</td></tr>
<tr class="memdesc:a3e74925e4bb4cb937a3ac4b951f41119"><td class="mdescLeft">&#160;</td><td class="mdescRight">Notifies the compressor about the node its IP address.  <a href="compressor_8c.html#a3e74925e4bb4cb937a3ac4b951f41119">More...</a><br /></td></tr>
<tr class="separator:a3e74925e4bb4cb937a3ac4b951f41119"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4fd03f3acd56b4bf55fc4c8e48567ab7"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a4fd03f3acd56b4bf55fc4c8e48567ab7">schc_compressor_init</a> (uint8_t src[16])</td></tr>
<tr class="memdesc:a4fd03f3acd56b4bf55fc4c8e48567ab7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the SCHC compressor.  <a href="compressor_8c.html#a4fd03f3acd56b4bf55fc4c8e48567ab7">More...</a><br /></td></tr>
<tr class="separator:a4fd03f3acd56b4bf55fc4c8e48567ab7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b8fe3cf10dcb9935bcbc92bb1b9c8f9"><td class="memItemLeft" align="right" valign="top">int16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a7b8fe3cf10dcb9935bcbc92bb1b9c8f9">schc_compress</a> (uint8_t *data, uint16_t total_length, <a class="el" href="structschc__bitarray__t.html">schc_bitarray_t</a> *dst, uint32_t device_id, <a class="el" href="schc_8h.html#a99f26e6ee9fcd62f75203b5402df8098">direction</a> dir, struct <a class="el" href="structschc__rule__t.html">schc_rule_t</a> **schc_rule)</td></tr>
<tr class="memdesc:a7b8fe3cf10dcb9935bcbc92bb1b9c8f9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compresses a CoAP/UDP/IP packet.  <a href="compressor_8c.html#a7b8fe3cf10dcb9935bcbc92bb1b9c8f9">More...</a><br /></td></tr>
<tr class="separator:a7b8fe3cf10dcb9935bcbc92bb1b9c8f9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a67645e8b7174e226c4fd4892f81ae517"><td class="memItemLeft" align="right" valign="top">static uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a67645e8b7174e226c4fd4892f81ae517">compute_length</a> (unsigned char *data, uint16_t data_len)</td></tr>
<tr class="memdesc:a67645e8b7174e226c4fd4892f81ae517"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the packet length for the UDP and IP headers.  <a href="compressor_8c.html#a67645e8b7174e226c4fd4892f81ae517">More...</a><br /></td></tr>
<tr class="separator:a67645e8b7174e226c4fd4892f81ae517"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa4e0f02b97163cd6f8c09b6ac5736aa7"><td class="memItemLeft" align="right" valign="top">static uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#aa4e0f02b97163cd6f8c09b6ac5736aa7">chksum</a> (uint16_t sum, const uint8_t *data, uint16_t len)</td></tr>
<tr class="separator:aa4e0f02b97163cd6f8c09b6ac5736aa7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a89368d1a9e14855697684aa89b0f1aac"><td class="memItemLeft" align="right" valign="top">uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a89368d1a9e14855697684aa89b0f1aac">compute_checksum</a> (unsigned char *data)</td></tr>
<tr class="memdesc:a89368d1a9e14855697684aa89b0f1aac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the UDP checksum and sets the appropriate header fields.  <a href="compressor_8c.html#a89368d1a9e14855697684aa89b0f1aac">More...</a><br /></td></tr>
<tr class="separator:a89368d1a9e14855697684aa89b0f1aac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8af6027989d3e39cdcc37f16ff38d7ff"><td class="memItemLeft" align="right" valign="top">uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a8af6027989d3e39cdcc37f16ff38d7ff">schc_decompress</a> (<a class="el" href="structschc__bitarray__t.html">schc_bitarray_t</a> *bit_arr, uint8_t *buf, uint32_t device_id, uint16_t total_length, <a class="el" href="schc_8h.html#a99f26e6ee9fcd62f75203b5402df8098">direction</a> dir)</td></tr>
<tr class="memdesc:a8af6027989d3e39cdcc37f16ff38d7ff"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct the header from the layered set of rules.  <a href="compressor_8c.html#a8af6027989d3e39cdcc37f16ff38d7ff">More...</a><br /></td></tr>
<tr class="separator:a8af6027989d3e39cdcc37f16ff38d7ff"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:af88fc53bc74390cc215e9b1548f38359"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="schc_8h.html#a871e6877df8d1bf5f1d0690d6b918f6b">schc_ipaddr_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#af88fc53bc74390cc215e9b1548f38359">node_ip_6</a></td></tr>
<tr class="separator:af88fc53bc74390cc215e9b1548f38359"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a832436cdee822ecccd06537f5e889955"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structjsmn__parser.html">jsmn_parser</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a832436cdee822ecccd06537f5e889955">json_parser</a></td></tr>
<tr class="separator:a832436cdee822ecccd06537f5e889955"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d19fbe1409f7470283881e0b642c417"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structjsmntok__t.html">jsmntok_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="compressor_8c.html#a6d19fbe1409f7470283881e0b642c417">json_token</a> [<a class="el" href="schc__config__example_8h.html#a4e7d67d7aea26c4f57d1098595f90662">JSON_TOKENS</a>]</td></tr>
<tr class="separator:a6d19fbe1409f7470283881e0b642c417"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="aa4e0f02b97163cd6f8c09b6ac5736aa7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa4e0f02b97163cd6f8c09b6ac5736aa7">&#9670;&nbsp;</a></span>chksum()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint16_t chksum </td>
          <td>(</td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>sum</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="a965c3a63dd22c405c83c4164f10f9985"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a965c3a63dd22c405c83c4164f10f9985">&#9670;&nbsp;</a></span>compress()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint8_t compress </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structschc__bitarray__t.html">schc_bitarray_t</a> *&#160;</td>
          <td class="paramname"><em>dst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structschc__bitarray__t.html">schc_bitarray_t</a> *&#160;</td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const struct <a class="el" href="structschc__layer__rule__t.html">schc_layer_rule_t</a> *&#160;</td>
          <td class="paramname"><em>rule</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="schc_8h.html#a99f26e6ee9fcd62f75203b5402df8098">direction</a>&#160;</td>
          <td class="paramname"><em>DI</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>The compression mechanism. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">dst_arr</td><td>the bit array in which to copy the contents to </td></tr>
    <tr><td class="paramname">src_arr</td><td>the original header </td></tr>
    <tr><td class="paramname">rule</td><td>the rule to match the compression with</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the length length of the compressed header </dd></dl>

</div>
</div>
<a id="a89368d1a9e14855697684aa89b0f1aac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a89368d1a9e14855697684aa89b0f1aac">&#9670;&nbsp;</a></span>compute_checksum()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint16_t compute_checksum </td>
          <td>(</td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>data</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the UDP checksum and sets the appropriate header fields. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>pointer to the data packet</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>checksum the computed checksum </dd></dl>

</div>
</div>
<a id="a67645e8b7174e226c4fd4892f81ae517"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a67645e8b7174e226c4fd4892f81ae517">&#9670;&nbsp;</a></span>compute_length()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint16_t compute_length </td>
          <td>(</td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>data_len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set the packet length for the UDP and IP headers. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>pointer to the data packet </td></tr>
    <tr><td class="paramname">data_len</td><td>the length of the total packet</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 </dd></dl>

</div>
</div>
<a id="af8317d5d5e72076851ec7fe49688f4a7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af8317d5d5e72076851ec7fe49688f4a7">&#9670;&nbsp;</a></span>decompress()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint8_t decompress </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structschc__layer__rule__t.html">schc_layer_rule_t</a> *&#160;</td>
          <td class="paramname"><em>rule</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structschc__bitarray__t.html">schc_bitarray_t</a> *&#160;</td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structschc__bitarray__t.html">schc_bitarray_t</a> *&#160;</td>
          <td class="paramname"><em>dst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="schc_8h.html#a99f26e6ee9fcd62f75203b5402df8098">direction</a>&#160;</td>
          <td class="paramname"><em>DI</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>The decompression mechanism. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">rule</td><td>pointer to the rule to use during the decompression </td></tr>
    <tr><td class="paramname">src</td><td>the received SCHC bit buffer </td></tr>
    <tr><td class="paramname">dst</td><td>the buffer to store the decompressed, original packet</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the length of the decompressed header </dd></dl>

</div>
</div>
<a id="a9991f6ae222b8d657ebb0e0b162ea282"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9991f6ae222b8d657ebb0e0b162ea282">&#9670;&nbsp;</a></span>equal()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint8_t equal </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structschc__field.html">schc_field</a> *&#160;</td>
          <td class="paramname"><em>target_field</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>field_value</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>field_offset</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>The equal matching operator. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">target_field</td><td>the field from the rule </td></tr>
    <tr><td class="paramname">field_value</td><td>the value from the header to compare with the rule value </td></tr>
    <tr><td class="paramname">field_offset</td><td>the offset (in bits), starting from the field value pointer</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1 if the target field matches the field value 0 if the target field doesn't match the field value </dd></dl>

</div>
</div>
<a id="ac9e32a3cb72316274db7b597a9aca407"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac9e32a3cb72316274db7b597a9aca407">&#9670;&nbsp;</a></span>get_device_by_id()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static struct <a class="el" href="structschc__device.html">schc_device</a>* get_device_by_id </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>device_id</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get a device by it's id. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">device_id</td><td>the id of the device</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="structschc__device.html">schc_device</a> the device which is found NULL if no device was found </dd></dl>

</div>
</div>
<a id="ac1569580e90e636a6d48366af83f3164"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac1569580e90e636a6d48366af83f3164">&#9670;&nbsp;</a></span>get_node_ip()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void get_node_ip </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="schc_8h.html#a871e6877df8d1bf5f1d0690d6b918f6b">schc_ipaddr_t</a> *&#160;</td>
          <td class="paramname"><em>node_ip</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get the node its IP address as set during initialization. </p>
<dl class="section return"><dt>Returns</dt><dd>node_ip_6 the node its IP address </dd></dl>

</div>
</div>
<a id="ab1cdc4ecc8218636dd177a43cf85bb63"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab1cdc4ecc8218636dd177a43cf85bb63">&#9670;&nbsp;</a></span>get_schc_rule_by_layer_ids()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static struct <a class="el" href="structschc__rule__t.html">schc_rule_t</a>* get_schc_rule_by_layer_ids </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>ip_rule_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>udp_rule_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>coap_rule_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>device_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="schc_8h.html#a00b61f9b90ab7065eb6a978141d7fd34">reliability_mode</a>&#160;</td>
          <td class="paramname"><em>mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="aaf76c0525a94eecb1f694ba09b435c49"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aaf76c0525a94eecb1f694ba09b435c49">&#9670;&nbsp;</a></span>get_schc_rule_by_reliability_mode()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="structschc__rule__t.html">schc_rule_t</a>* get_schc_rule_by_reliability_mode </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structschc__rule__t.html">schc_rule_t</a> *&#160;</td>
          <td class="paramname"><em>schc_rule</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="schc_8h.html#a00b61f9b90ab7065eb6a978141d7fd34">reliability_mode</a>&#160;</td>
          <td class="paramname"><em>mode</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>device_id</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a0403165232716bdd5f3a06169692c2a9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0403165232716bdd5f3a06169692c2a9">&#9670;&nbsp;</a></span>get_schc_rule_by_rule_id()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct <a class="el" href="structschc__rule__t.html">schc_rule_t</a>* get_schc_rule_by_rule_id </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>rule_arr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>device_id</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a394540a77045dcb0230079435b631960"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a394540a77045dcb0230079435b631960">&#9670;&nbsp;</a></span>ignore()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint8_t ignore </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structschc__field.html">schc_field</a> *&#160;</td>
          <td class="paramname"><em>target_field</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>field_value</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>field_offset</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>The ignore matching operator. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">target_field</td><td>the field from the rule </td></tr>
    <tr><td class="paramname">field_value</td><td>the value from the header to compare with the rule value</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1 </dd></dl>

</div>
</div>
<a id="a5371dbc9847ed58dc760b7f028ea14e9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5371dbc9847ed58dc760b7f028ea14e9">&#9670;&nbsp;</a></span>matchmap()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint8_t matchmap </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structschc__field.html">schc_field</a> *&#160;</td>
          <td class="paramname"><em>target_field</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>field_value</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>field_offset</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>The match-map matching operator match-mapping: With match-mapping, the Target Value is a list of values. </p>
<p>Each value of the list is identified by an index. Compression is achieved by sending the index instead of the original header field value.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">target_field</td><td>the field from the rule </td></tr>
    <tr><td class="paramname">field_value</td><td>the value from the header to compare with the rule value</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1 if the the field value is equal to one of the values found in the mapping array 0 if no matching value is found in the mapping array </dd></dl>

</div>
</div>
<a id="abd91def21b62074e08368e9bb11593d5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abd91def21b62074e08368e9bb11593d5">&#9670;&nbsp;</a></span>MSB()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint8_t MSB </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structschc__field.html">schc_field</a> *&#160;</td>
          <td class="paramname"><em>target_field</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>field_value</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>field_offset</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>The MSB matching operator MSB(x): a match is obtained if the most significant (leftmost) x bits of the packet header field value are equal to the TV in the Rule. </p>
<p>The x parameter of the MSB MO indicates how many bits are involved in the comparison. If the FL is described as variable, the x parameter must be a multiple of the FL unit. For example, x must be multiple of 8 if the unit of the variable length is bytes.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">target_field</td><td>the field from the rule </td></tr>
    <tr><td class="paramname">field_value</td><td>the value from the header to compare with the rule value</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>1 if the MSB of the target field matches the MSB of the field value 0 if the MSB of the target field doesn't match the MSB of the field value </dd></dl>

</div>
</div>
<a id="a7b8fe3cf10dcb9935bcbc92bb1b9c8f9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7b8fe3cf10dcb9935bcbc92bb1b9c8f9">&#9670;&nbsp;</a></span>schc_compress()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int16_t schc_compress </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>total_length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structschc__bitarray__t.html">schc_bitarray_t</a> *&#160;</td>
          <td class="paramname"><em>dst</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>device_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="schc_8h.html#a99f26e6ee9fcd62f75203b5402df8098">direction</a>&#160;</td>
          <td class="paramname"><em>dir</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct <a class="el" href="structschc__rule__t.html">schc_rule_t</a> **&#160;</td>
          <td class="paramname"><em>schc_rule</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Compresses a CoAP/UDP/IP packet. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>pointer to the original packet </td></tr>
    <tr><td class="paramname">total_length</td><td>the length of the packet </td></tr>
    <tr><td class="paramname">dst</td><td>pointer to the bit array object, where the compressed packet will be stored. Can later be passed to fragmenter </td></tr>
    <tr><td class="paramname">device_id</td><td>the device id to find a rule for </td></tr>
    <tr><td class="paramname">direction</td><td>the direction of the flow UP: LPWAN to IPv6 or DOWN: IPv6 to LPWAN </td></tr>
    <tr><td class="paramname">device_type</td><td>the device type: NETWORK_GATEWAY or DEVICE </td></tr>
    <tr><td class="paramname">schc_rule</td><td>a pointer to a schc rule struct to return the rule that was found</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>length the length of the compressed packet -1 on a memory overflow</dd></dl>
<dl class="section note"><dt>Note</dt><dd>the compressor will only look for rules configured with the NOT_FRAGMENTED reliability mode </dd></dl>

</div>
</div>
<a id="a4fd03f3acd56b4bf55fc4c8e48567ab7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4fd03f3acd56b4bf55fc4c8e48567ab7">&#9670;&nbsp;</a></span>schc_compressor_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t schc_compressor_init </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>src</em>[16]</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initializes the SCHC compressor. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">node_ip</td><td>a pointer to the source it's ip address</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>error error codes on error </dd></dl>

</div>
</div>
<a id="a8af6027989d3e39cdcc37f16ff38d7ff"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8af6027989d3e39cdcc37f16ff38d7ff">&#9670;&nbsp;</a></span>schc_decompress()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint16_t schc_decompress </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structschc__bitarray__t.html">schc_bitarray_t</a> *&#160;</td>
          <td class="paramname"><em>bit_arr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>device_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>total_length</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="schc_8h.html#a99f26e6ee9fcd62f75203b5402df8098">direction</a>&#160;</td>
          <td class="paramname"><em>dir</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Construct the header from the layered set of rules. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">data</td><td>pointer to the received data </td></tr>
    <tr><td class="paramname">buf</td><td>pointer where to save the decompressed packet </td></tr>
    <tr><td class="paramname">device_id</td><td>the device its id </td></tr>
    <tr><td class="paramname">total_length</td><td>the total length of the received data </td></tr>
    <tr><td class="paramname">direction</td><td>the direction of the flow (UP: LPWAN to IPv6, DOWN: IPv6 to LPWAN)</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>length length of the newly constructed packet 0 the rule was not found </dd></dl>

</div>
</div>
<a id="a8137a81bb5ae333086b8aaf814b10a62"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8137a81bb5ae333086b8aaf814b10a62">&#9670;&nbsp;</a></span>schc_find_rule_from_header()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static struct <a class="el" href="structschc__layer__rule__t.html">schc_layer_rule_t</a>* schc_find_rule_from_header </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structschc__bitarray__t.html">schc_bitarray_t</a> *&#160;</td>
          <td class="paramname"><em>src</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>device_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="schc_8h.html#ac6a26bb50f32ca8810179e894e284ea0">schc_layer_t</a>&#160;</td>
          <td class="paramname"><em>layer</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="schc_8h.html#a99f26e6ee9fcd62f75203b5402df8098">direction</a>&#160;</td>
          <td class="paramname"><em>DI</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Find a matching rule for a layer. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">schc_bitarray</td><td>the bit array as received from the network note: a conversion is required for CoAP to decode the options</td></tr>
    <tr><td class="paramname">device_id</td><td>the device to find an IP rule for </td></tr>
    <tr><td class="paramname">schc_layer</td><td>the layer for which to find a rule for</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the rule NULL if no rule is found </dd></dl>

</div>
</div>
<a id="a3e74925e4bb4cb937a3ac4b951f41119"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3e74925e4bb4cb937a3ac4b951f41119">&#9670;&nbsp;</a></span>set_node_ip()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void set_node_ip </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="schc_8h.html#a871e6877df8d1bf5f1d0690d6b918f6b">schc_ipaddr_t</a> *&#160;</td>
          <td class="paramname"><em>node_ip</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Notifies the compressor about the node its IP address. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">node_ip</td><td>pointer to the ip address array</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 </dd></dl>

</div>
</div>
<a id="a15002a02e9cae01e5629cb2d474fe482"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a15002a02e9cae01e5629cb2d474fe482">&#9670;&nbsp;</a></span>set_rule_id()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int8_t set_rule_id </td>
          <td>(</td>
          <td class="paramtype">struct <a class="el" href="structschc__rule__t.html">schc_rule_t</a> *&#160;</td>
          <td class="paramname"><em>schc_rule</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a263bfe2b1b6914b5b715f434f154d07b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a263bfe2b1b6914b5b715f434f154d07b">&#9670;&nbsp;</a></span>swap_ipv6_source_and_destination()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void swap_ipv6_source_and_destination </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>ptr</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Swaps the IPv6 source and destination. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ptr</td><td>pointer to the ipv6 header </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="a832436cdee822ecccd06537f5e889955"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a832436cdee822ecccd06537f5e889955">&#9670;&nbsp;</a></span>json_parser</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structjsmn__parser.html">jsmn_parser</a> json_parser</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a6d19fbe1409f7470283881e0b642c417"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6d19fbe1409f7470283881e0b642c417">&#9670;&nbsp;</a></span>json_token</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structjsmntok__t.html">jsmntok_t</a> json_token[<a class="el" href="schc__config__example_8h.html#a4e7d67d7aea26c4f57d1098595f90662">JSON_TOKENS</a>]</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="af88fc53bc74390cc215e9b1548f38359"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af88fc53bc74390cc215e9b1548f38359">&#9670;&nbsp;</a></span>node_ip_6</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="schc_8h.html#a871e6877df8d1bf5f1d0690d6b918f6b">schc_ipaddr_t</a> node_ip_6</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
